package com.prs.crm.domain.oa;

import java.util.Date;
import java.util.List;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

import com.prs.crm.domain.Attachment;
import com.prs.crm.domain.BaseEntity;
/**
 * OA已发新闻
 * @author zhoupeng 2012-3-22
 *
 */
@Entity
@Table(name="oa_news")
public class News extends BaseEntity{
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer id;
	
	private String title;  //标题
	@Lob
	private String content;  //内容
	private String receive; //接收人
	private String accepts;  //接收人id
	private String degree;  //重要程度
	private String isReceipt;  //收到后给我一个回执
	private String isComment;  //允许评论
	private String level;  //样式
	
	private Integer oabox;  //0表示草稿，1表示已发新闻，2表示已归档,3表示已收藏
	
	private String flow;  //流程
	@ManyToOne(fetch=FetchType.LAZY)
	@Cascade(CascadeType.REFRESH)
	private Attachment attach; //文件
	private Date creatTime;  //创建时间
//	//已收新闻
//	@OneToMany(fetch=FetchType.LAZY,mappedBy="news")
//	private Set<NewsReceive> recevies;
	//收藏新闻
	@OneToMany(fetch=FetchType.LAZY,mappedBy="news")
	private Set<NewsCollect> collects;
	@OneToMany(fetch=FetchType.LAZY,mappedBy="news")
	@Cascade({org.hibernate.annotations.CascadeType.ALL,org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
	private List<NewsComment> newsComments;
	@OneToMany(fetch=FetchType.LAZY,mappedBy="news")
	private List<Comment> comment;
	public List<Comment> getComment() {
		return comment;
	}
	public void setComment(List<Comment> comment) {
		this.comment = comment;
	}
	public List<NewsComment> getNewsComments() {
		return newsComments;
	}
	public void setNewsComments(List<NewsComment> newsComments) {
		this.newsComments = newsComments;
	}
	private Integer top;//0位置顶 //1置顶 
	public Integer getTop() {
		return top;
	}
	public void setTop(Integer top) {
		this.top = top;
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getReceive() {
		return receive;
	}
	public void setReceive(String receive) {
		this.receive = receive;
	}
	public String getDegree() {
		return degree;
	}
	public void setDegree(String degree) {
		this.degree = degree;
	}
	public String getIsReceipt() {
		return isReceipt;
	}
	public void setIsReceipt(String isReceipt) {
		this.isReceipt = isReceipt;
	}
	public String getIsComment() {
		return isComment;
	}
	public void setIsComment(String isComment) {
		this.isComment = isComment;
	}
	public String getLevel() {
		return level;
	}
	public void setLevel(String level) {
		this.level = level;
	}
	public Integer getOabox() {
		return oabox;
	}
	public void setOabox(Integer oabox) {
		this.oabox = oabox;
	}
	public String getFlow() {
		return flow;
	}
	public void setFlow(String flow) {
		this.flow = flow;
	}
	public Attachment getAttach() {
		return attach;
	}
	public void setAttach(Attachment attach) {
		this.attach = attach;
	}
	public Date getCreatTime() {
		return creatTime;
	}
	public void setCreatTime(Date creatTime) {
		this.creatTime = creatTime;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
/*	public Set<NewsReceive> getRecevies() {
		return recevies;
	}
	public void setRecevies(Set<NewsReceive> recevies) {
		this.recevies = recevies;
	}*/
	public String getAccepts() {
		return accepts;
	}
	public void setAccepts(String accepts) {
		this.accepts = accepts;
	}
	public Set<NewsCollect> getCollects() {
		return collects;
	}
	public void setCollects(Set<NewsCollect> collects) {
		this.collects = collects;
	}
	
}
